<template>
  <button @click="add">添加</button>
  <button @click="del">删除</button>
  <transition-group
      enter-active-class="animate__animated animate__zoomInDown"
      leave-active-class="animate__animated animate__zoomOutUp">
    <div class="lhz" v-for="num in nums" :key="num" v-text="num"></div>
  </transition-group>
</template>

<script>
export default {
  name: "LhzA",
  data() {
    return {
      nums: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
      reference: 10,
    }
  },
  methods: {
    add() {
      this.nums.splice(Math.floor(Math.random() * this.nums.length), 0, this.reference++)
    },
    del() {
      this.nums.splice(Math.floor(Math.random() * this.nums.length), 1)
    }
  }
}
</script>

<style scoped>
button {
  width: 300px;
  height: 100px;
  font-size: 66px;
}

.lhz {
  float: left;
  margin-top: 115px;
  margin-left: 15px;
  width: 60px;
  height: 60px;
  text-align: center;
  line-height: 60px;
  background-color: #123456;
  color: #FFFFFF;
  font-size: 32px;
}
</style>